package com.example.shushiyunsst.fragment.main.home.child.fu_li_pool.sub

import android.os.Bundle
import android.view.View
import com.example.library_common.adapter.JssBaseViewHolder
import com.example.library_common.album.utils.Utils
import com.example.library_common.base.SimpleListFragment
import com.example.library_common.bean.CommonBean
import com.example.shushiyunsst.R
import com.example.shushiyunsst.fragment.main.home.child.fu_li_pool.bean.SubLiShiFuLiBean
import com.example.shushiyunsst.fragment.main.home.child.fu_li_pool.bean.SubLiShiFuLiLab
import ikidou.reflect.TypeBuilder
import java.lang.reflect.Type

/**
 * 历史福利(子页面)
 * */
class SubLiShiFuLiFragment(override val labInfo: Int) : SimpleListFragment<SubLiShiFuLiBean>(),
    SubLiShiFuLiLab {

    companion object {
        fun newInstance(labInfo: Int): SubLiShiFuLiFragment {
            val args = Bundle()
            val fragment = SubLiShiFuLiFragment(labInfo)
            fragment.arguments = args
            return fragment
        }


    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        isEnableLoadMore = false
        isAddDividerItemDecoration = false
        mSuperBackPressedSupport = false
    }

    override fun initView(view: View) {
        super.initView(view)
        mSwipeRefreshLayout.setColorScheme(R.color.nav_bar_bg_color)
        mRecyclerView.overScrollMode = View.OVER_SCROLL_NEVER
        mSwipeRefreshLayout.setProgressBackgroundColor(R.color.colorAccent)

    }

    override fun getItemLayout() = R.layout.sub_li_shi_fu_li_fragment

    override fun convertItem(helper: JssBaseViewHolder?, item: SubLiShiFuLiBean?) {
        helper?.setText(R.id.seasonTv, item?.season)
            ?.setText(R.id.timePoint, "${item?.start_time}\n|\n${item?.end_time}")
            ?.setText(R.id.value, "1130.5000USDT")
    }

    override fun getListType(): Type {
        return TypeBuilder.newInstance(CommonBean::class.java)
            .beginSubType(List::class.java)
            .addTypeParam(SubLiShiFuLiBean::class.java).endSubType().build()
    }

    override fun netRequest() {
//        val jsonFromRaw = Utils.getJsonFromRaw(_mActivity, R.raw.sub_li_shi_fu_li)
//        parseDate(jsonFromRaw)

        val jsonFromRaw =""
        parseDate(jsonFromRaw)
    }
}